﻿using LD.Controls.ControlHelper;
using System;
using System.Windows.Forms;

namespace LD
{
    public partial class FrmWip3 : FrmBase
    {
        private ReDrawUI ReDrawUI = new ReDrawUI();
        public FrmWip3()
        {
            InitializeComponent();
            //TODO 此处需要实时获取电批数据
            //ScrewHelper.Instance.OnDataChanged += Instance_OnDataChanged;

            WipHelper.Instance.Load();

            Init();
            FormScaler.ScaleForm(this,true);//自动缩放
        }

        private void FrmWip_Shown(object sender, EventArgs e)
        {
        }

        private void FrmMachineInfo_VisibleChanged(object sender, EventArgs e)
        {
            this.timer1.Enabled = this.Visible;
        }
        private void Init()
        {
    
        }
        private void timer1_Tick(object sender, EventArgs e)
        {
        
        }

        private void FrmMachineInfo_FormClosing(object sender, FormClosingEventArgs e)
        {
            this.timer1.Enabled = false;
        }

        private void FrmWip_Load(object sender, EventArgs e)
        {
            //this.Resize += new EventHandler(FrmWip_Resize);
            //ReDrawUI.ControlInitializeSize(this);

        }

        private void Instance_OnDataChanged(object sender, TB_Screw e)
        {
            if (!this.IsDisposed)
            {
                this.Invoke(new Action(() =>
                {
                
                }));
            }
        }

        private void FrmWip_Resize(object sender, EventArgs e)
        {
            ReDrawUI.ControlAutoSize(this);
        }

        private void btn_clearWIP_Click(object sender, EventArgs e)
        {
            //WipHelper.Instance.WipData.Input = 0;
            //WipHelper.Instance.WipData.NG = 0;
            //WipHelper.Instance.WipData.Pass = 0;
            //WipHelper.Instance.WipData.B_CT = 0;
            //WipHelper.Instance.WipData.A_CT = 0;
            //WipHelper.Instance.WipData.B_Screw_Paoliao = 0;
            //WipHelper.Instance.WipData.B_Screw_Total = 0;
            //WipHelper.Instance.WipData.A_Screw_Paoliao = 0;
            //WipHelper.Instance.WipData.A_Screw_Total = 0;
            //WipHelper.Instance.Save();
        }

     
    }
}
